I'm Trying to achieve that the user can see only HIS applications, and not the "Application Index" containing all the applications from all Users.
My Header:
<%= link_to "My Application ", current_user.application %>
My Abilities:
if user.has_role? :speaker
can :read, Application do |application| # heres the problem
application.try(:user) == user
end
can :create, Application
can :update, Application do |application|
application.try(:user) == user
end
end
Currently the User can access the Application/Index page. But the restriction should give him only access to:
http://localhost:3000/applications/8 # 8 being his application
What am i missing ?